//水印管理.js

function search(){
    $("#page").val("1");
    $("#search_form").submit();
};
function toIsEmpty(){
	document.getElementsByName("name")[0].value = "";
	document.getElementsByName("status")[0].value = "";
	document.getElementsByName("shStatus")[0].value = "";
	$("#startDate").val("");
	$("#endDate").val("");
	$("#createDate").val("");
    $("#page").val("1");
 };
 function addWaterMark(){
		var url=path+"/product_water_mark/to_add_water_mark";
	    var index = layer.open({
	        type: 2,
	        title: "添加商品水印",
	        scrollbar: false,
	        content: url,
	        area: ['1000px', '600px']
	    });
 }
 function editWaterMark(id){
		var url=path+"/product_water_mark/to_update_water_mark?id="+id;
	    var index = layer.open({
	        type: 2,
	        title: "添加商品水印",
	        scrollbar: false,
	        content: url,
	        area: ['1000px', '600px']
	    });
 }
 function deleteWaterMark(id){
	 layer.confirm("确定删除此水印？",function(){
			layer.closeAll('dialog');
			var layer_load_window = layer.load(2); 
			 $.ajax({
					url : path+"/product_water_mark/delete_water_mark",
					cache : false,
					type : 'post',
					dataType : 'text',
					data:{'id':id},
					error : function() {
						layer.alert("操作失败！");
			       },
					success : function(data) {
					    if(data == "success"){
						    layer.msg('删除成功!',{icon:1,time:1000},function(){
						    	$("#search_form").submit();
						    });
					   } else if(data == "fail") {
						   layer.alert("操作失败");
					   } else {
						layer.alert(data);
					   }
					},
					complete: function(XMLHttpRequest, textStatus) {
						layer.close(layer_load_window);
					}
				  })	
		 });
	 
 }
 function lookWaterMark(id){
		var url=path+"/product_water_mark/look_water_mark?id="+id;
	    var index = layer.open({
	        type: 2,
	        title: "查看商品水印",
	        scrollbar: false,
	        content: url,
	        area: ['800px', '600px']
	    });
 }
 function auditWaterMark(id){
		var url=path+"/product_water_mark/audit_water_mark?id="+id;
	    var index = layer.open({
	        type: 2,
	        title: "审核商品水印",
	        scrollbar: false,
	        content: url,
	        area: ['800px', '600px']
	    });
}